import Layout from '@/pages/Layout'
import Login from '@/pages/Login'
// 引进二级路由
import Publish from '@/pages/Publish'
import Article from '@/pages/Article'
import Home from '@/pages/Home'
// 引入创建路由实例的 createBrowserRouter钩子函数
import { createBrowserRouter } from 'react-router-dom'
// 引入这个高阶组件
import AuthRoute from '@/components/AuthRoute'

// 配置路由实例

const router = createBrowserRouter([
	{
		path: '/',
		element: (
			<AuthRoute>
				<Layout />
			</AuthRoute>
		),
		children: [
			{
				// path: 'home',
				index: true,
				element: <Home />
			},
			{
				path: 'article',
				element: <Article />
			},
			{
				path: 'publish',
				element: <Publish />
			}
		]
	},
	{
		path: '/login',
		element: <Login />
	}
])

// 导出实例
export default router
